package com.example.smart_light.servlet;

import com.example.smart_light.socket.SocketService;

import java.io.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;

@WebServlet(urlPatterns = "/openOrCloseServlet")
public class OpenOrCloseServlet extends HttpServlet {

    public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
        String flag = request.getParameter("switchFlag");
        System.out.println(flag);
        SocketService.sendToAll(flag);
        response.getWriter().write("success");
    }

}